

import { LGXEnums } from '../../common/sysenum'


import rectdragsvc from './rectdragsvc.js';
import busdragsvc from './busdragsvc';
import linedragsvc from './linedragsvc';
import circledragsvc from './circledragsvc';
import molddragsvc from './molddragsvc';
import imagedragsvc from './imagedragsvc';
import beziercurvedragsvc from './beziercurvedragsvc';
import quadraticCurvedragsvc from './quadraticcurvedragsvc.js';
import containerdragsvc from './containerdragsvc';
import arcdragsvc from './arcdragsvc';
import mulstardragsvc from './mulstardragsvc';
import regularpolygondragsvc from './regularpolygondragsvc';
import cylinderdragsvc from './cylinderdragsvc';
import cubedragsvc from './cubedragsvc';
import specialrectdragsvc from './specialrectdragsvc';
import ellipsedragsvc from './ellipsedragsvc';

var DragDropGraphSvcFactory = {

}



DragDropGraphSvcFactory.createSvcByEnums = function (graph) {
    var pDragDropSvc = null;
    switch (graph.m_graphType) {
        case LGXEnums.LGXGraphType.LineGraph_type:
            pDragDropSvc = new linedragsvc.LineDragDropSvc(graph);
            break;

        case LGXEnums.LGXGraphType.CircleGraph_type:
            pDragDropSvc = new circledragsvc.CircleDragDropSvc(graph);
            break;

        case LGXEnums.LGXGraphType.PolygonGraph_type:
        case LGXEnums.LGXGraphType.RegularPolygon_type:
        case LGXEnums.LGXGraphType.MultiStar_type:
            pDragDropSvc = this.createSpecialPolygonDragSvc(graph);
            break;

        case LGXEnums.LGXGraphType.ImageGraph_type:
            pDragDropSvc = new imagedragsvc.ImageDragDropSvc(graph);
            break;

        case LGXEnums.LGXGraphType.RectGraph_type:
            pDragDropSvc = new rectdragsvc.RectDragDropSvc(graph);
            break;

        case LGXEnums.LGXGraphType.MoldGraph_type:
        case LGXEnums.LGXGraphType.umlpackage_type:
        case LGXEnums.LGXGraphType.Container_type:
        case LGXEnums.LGXGraphType.containerItem_type:
            pDragDropSvc = new molddragsvc.MoldDragDropSvc(graph);
            break;


        case LGXEnums.LGXGraphType.CommBusGraph_type:
            pDragDropSvc = new busdragsvc.BusDragDropSvc(graph);
            break;

        case LGXEnums.LGXGraphType.TextGraph_type:
            break;

        case LGXEnums.LGXGraphType.Combine_type:
            pDragDropSvc = new containerdragsvc.ContainerDragDropSvc(graph);
            break;

        case LGXEnums.LGXGraphType.TerminalGraph_type:
            break;

        case LGXEnums.LGXGraphType.PipeLineGraph_Type:
            break;

        case LGXEnums.LGXGraphType.TimerCtrl_type:
            break;

        case LGXEnums.LGXGraphType.QuadraticCurve_type:
            pDragDropSvc = new quadraticCurvedragsvc.QuadraticCurveDragDropSvc(graph);
            break;

        case LGXEnums.LGXGraphType.BezierCurve_type:
            pDragDropSvc = new beziercurvedragsvc.BezierCurveDragDropSvc(graph);
            break;

        case LGXEnums.LGXGraphType.ArcGraph_type:
            pDragDropSvc = new arcdragsvc.ArcDragDropSvc(graph);
            break;

        case LGXEnums.LGXGraphType.Cylinder_type:
            pDragDropSvc = new cylinderdragsvc.CylinderDragDropSvc(graph);
            break;

        case LGXEnums.LGXGraphType.Cube_type:
            pDragDropSvc = new cubedragsvc.CubeDragDropSvc(graph);
            break;

        case LGXEnums.LGXGraphType.SpecialRect_type:
            pDragDropSvc = new specialrectdragsvc.SpecialRectDragDropSvc(graph);
            break;

        case LGXEnums.LGXGraphType.EllipseGraph_type:
            pDragDropSvc = new ellipsedragsvc.EllipseDragDropSvc(graph);
            break;

        default:
            break;
    }

    return pDragDropSvc;
}

DragDropGraphSvcFactory.createSpecialPolygonDragSvc = function (graph) {
    var pDragDropSvc = null;
    let fulltoolKind = graph.getType();
    let subKind = fulltoolKind & 0x0000ff00;
    subKind = subKind >> 8;
    if (subKind == 0x01) {
        pDragDropSvc = new regularpolygondragsvc.RegularPolygonGraphDragDropSvc(graph);
    }
    else if (subKind == 0x02) {
        pDragDropSvc = new mulstardragsvc.MultiStarDragDropSvc(graph);
    }
    return pDragDropSvc;
}


export default { DragDropGraphSvcFactory }

